package com.gitee.yanfanvip.model;

import java.io.DataInputStream;
import java.io.IOException;

public enum ReciveEnum {
	PING(5),
	PULLDATA(6),
	SYNC(7);
	
	private final int type;
	private ReciveEnum(int type) {
		this.type = type;
	}
	public int getType() {
		return type;
	}
	
	public static ReciveEnum get(int type) {
		for (ReciveEnum e : ReciveEnum.values()) {
			if(e.type == type){
				return e;
			}
		}
		return null;
	}
	
	public static ReciveEnum get(DataInputStream in) throws IOException {
		int type = in.readInt();
		for (ReciveEnum e : ReciveEnum.values()) {
			if(e.type == type){
				return e;
			}
		}
		return null;
	}
}
